<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../../Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="../../Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="../../Css/style.css" />
    <script type="text/javascript" src="../../Js/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="../../Js/bootstrap.js"></script>
    <script type="text/javascript" src="../../Js/ckform.js"></script>
    <script type="text/javascript" src="../../Js/common.js"></script>
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }
    </style>
    <script>
    $(function(){
			$.ajax({
				type:"post",
				url:"../../user/queryall",
				contentType:"application/json;charset=utf-8",
				success:function(user){
					$('tbody').html("");
					for(var i = 0; i < user.length; i++){
						//alert(user[i].uid);
						$('tbody')
				  		.append("<tr id="+i+">"+
				  				"<td>"+user[i].uid+"</td>"+
				  				"<td>"+user[i].upwd+"</td>"+
				  				"<td>"+user[i].uname+"</td>"+
				  				"<td>"+user[i].uemail+"</td>"+
				  				"<td>"+"<a href=edit.html?userid="+user[i].uid+">编辑</a>"+"</td>"+ 
				  				"</tr>");
					}
					var count=user.length;
					$('#pagenum').html(count+" 条记录 1/"+	Math.ceil(count/12)+"页");
					}
				});
    });
	$(function(){
		$('#allquery').click(
		function(){
			$.ajax({
				type:"post",
				url:"../../user/queryall",
				contentType:"application/json;charset=utf-8",
				success:function(user){
					$('tbody').html("");
					for(var i = 0; i < user.length; i++){
						//alert(user[i].uid);
						$('tbody')
				  		.append("<tr id="+i+">"+
				  				"<td>"+user[i].uid+"</td>"+
				  				"<td>"+user[i].upwd+"</td>"+
				  				"<td>"+user[i].uname+"</td>"+
				  				"<td>"+user[i].uemail+"</td>"+
				  				"<td>"+"<a href=edit.html?userid="+user[i].uid+">编辑</a>"+"</td>"+ 
				  				"</tr>");
					}
					var count=user.length;
					$('#pagenum').html(count+" 条记录 1/"+	Math.ceil(count/12)+"页");
					}
				});
		}	
		);
	});	
	$(function(){
		$('#idquery').click(
		function(){
			var userid = $('#uid').val();
			$.ajax({
				type:"post",
				url:"../../user/query?userid="+userid,
				contentType:"application/json;charset=utf-8",
				success:function(user){
					$('tbody').html("");
					
						//alert(user[i].uid);
						$('tbody')
				  		.append("<tr id=1>"+
				  				"<td>"+user.uid+"</td>"+
				  				"<td>"+user.upwd+"</td>"+
				  				"<td>"+user.uname+"</td>"+
				  				"<td>"+user.uemail+"</td>"+
				  				"<td>"+"<a href=edit.html?userid="+user.uid+">编辑</a>"+"</td>"+ 
				  				"</tr>");
						$('#pagenum').html("1 条记录 1/1页");
					}
					
					
					
				});
		}	
		);
	});	
</script>
</head>
<body>
<form class="form-inline definewidth m20" action="index.html" method="get">    
    用户名称：
    <input type="text" name="uid" id="uid"class="abc input-default" placeholder="" value="">&nbsp;&nbsp;  
    <button type="button" class="btn btn-primary" id="idquery">查询</button>&nbsp;&nbsp; 
    <button type="button" class="btn btn-success" id="allquery">显示用户</button>
</form>
<table class="table table-bordered table-hover definewidth m10">
<thead>
    <tr>
        <th>帐号</th>
        <th>密码</th>
        <th>昵称</th>
        <th>邮箱</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    
    </tbody>
  
</table>
  <div class="inline pull-right page"><strong id="pagenum">0 条记录 0/0 页  </strong>
  	<a href='#'>下一页</a>
  	<span class='current'>1</span>
  	<a href='#' >下5页</a> <a href='#' >最后一页</a>    
  </div>
</body>
</html>